package main.Q901_1000;

import java.util.Arrays;

public class Q961_970 {
    public static void main(String[] args) {
        System.out.println("Question961：在长度 2N 的数组中找出重复 N 次的元素");
        System.out.println("Question962：");
        System.out.println("Question963：");
        System.out.println("Question964：");
        System.out.println("Question965：");
        System.out.println("Question966：");
        System.out.println("Question967：");
        System.out.println("Question968：");
        System.out.println("Question969：");
        System.out.println("Question970：");
    }
}

class Question961 {
    public int repeatedNTimes(int[] nums) {
        int result = 0, left = 0, right = nums.length / 2 - 1;
        Arrays.sort(nums);
        while (right < nums.length) {
            if (nums[left] == nums[right]) {
                result = nums[left];
                break;
            }
            left++;
            right++;
        }
        return result;
    }
}